package com.example.springboothelloworldquick.config;

import com.example.springboothelloworldquick.service.HelloService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Configuration 指明当前类是配置类
 *
 * 之前在配置文件中使用<bean></bean>标签
 */
@Configuration
public class MyAppConfig {

    //将方法的返回值添加到容器中：默认的id是方法名
    @Bean
    public HelloService helloService() {
        System.out.println("给容器中添加组件");
        return new HelloService();
    }
}
